Destructing assignment in another improvement in Es6. It allows us to extract data from array and objects into separate variables.
Example
let full_name =['John','Deo'];
let [first_name,last_name]=full_name;
console.log(first_name,last_name);
// outputs John Deo
Another example
let c=[100,200,330,400];
let [a,...b]=c;
console.log(a,b);
// outputs 100 [200, 330, 400]
Posted Date:- 2021-10-08 09:57:37
what is meant by Class Expressions?
What is difference between CoffeeScript and es6 ?
What is difference between ES6 and typescript?
What is Prototypal Inheritance in Javascript?
What is the use of let & const in JavaScript?
How to create a Javascript class in ES6?
Explain Destructuring Assignment in ES6?
What are the classes and proxies?
What is spread, default and rest parameter?
Explain the reason for using ES6 classes.
Explain the motivation behind Symbols to ES6.
Explain Internationalization and Localization.